<?php
function getsetting($name) {
	$presid=Contents::get_presence_id();
	$val=mysql_query("SELECT value FROM ". $GLOBALS["db_pref"] ."settings WHERE name='". $name ."' and presence='". $presid ."'");
	if (mysql_num_rows($val)==1) {
		$row=mysql_fetch_object($val);
		return $row->value;
	} else {
		die("Einstellung nicht gefunden");
	}
}

function getright($function, $userid="") {
	if ($userid=="" && !empty($_SESSION["userid"])) {
		$userid=$_SESSION["userid"];
	}
	$usergroup=mysql_query("SELECT gruppe FROM ". $GLOBALS["db_pref"] ."users WHERE id='". $userid ."'");
	$userrow=mysql_fetch_object($usergroup);
	$rights=mysql_query("SELECT ". $function ." FROM ". $GLOBALS["db_pref"] ."groups WHERE id='". $userrow->gruppe ."'");
	$rightsrow=mysql_fetch_object($rights);
	if ($rightsrow->$function==1) {
		return true;
	} else {
		return false;
	}
}
?>
